package com.zhang;

import com.alibaba.fastjson.JSON;
import com.zhang.entity.ScriptPart;
import com.zhang.entity.co.Script;

import java.util.HashMap;
import java.util.Map;

/**
 * User: 张
 * Date: 2024-11-20
 * Time: 11:42
 * Description:
 */

public class test {
    public static void main(String[] args) {
        Script script = new Script();
        ScriptPart part = new ScriptPart();
        part.setMethod(1);
        part.setAction("control_light");
        Map<String, String> map = new HashMap<>();
        map.put("--red","1");
        map.put("--green","0");
        map.put("--yellow","0");
        map.put("--brightness","80");
        part.setParameter(map);
        HashMap<Integer, ScriptPart> scriptMap = new HashMap<>();
        scriptMap.put(1,part);

        script.setScript(scriptMap);
        System.out.println(JSON.toJSONString(script));
    }
}
